package com.example.springboot_practice.Config;

import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * @Description: 测试配置多数据源
 * @Author 王宝凯
 * @Date 2020/9/9
 */
@Configuration
public class DataSourceConfig {
    @Bean
    @ConfigurationProperties(prefix = "spring.datasource.test1",ignoreInvalidFields = true)
    DataSource TestOne(){
        return DruidDataSourceBuilder.create().build();
    }

    @Bean
    @ConfigurationProperties(prefix = "spring.datasource.test2",ignoreInvalidFields = true)
    DataSource TestTwo(){
        return DruidDataSourceBuilder.create().build();
    }
}
